﻿using Abp.Domain.Entities;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GN.Pay.Core.Entities
{
    /// <summary>
    /// 商户应用信息抽象
    /// </summary>
    [Serializable]
    public abstract class AMerchantAppInfo : Entity<string>
    {
        /// <summary>
        /// 应用Id
        /// </summary>
        [Required]
        [StringLength(maximumLength: 32)]
        public override string Id
        {
            get
            {
                return base.Id;
            }

            set
            {
                base.Id = value;
            }
        }

        /// <summary>
        /// 商户Id
        /// </summary>
        [Required]
        [StringLength(maximumLength: 32)]
        public string MerchantId { get; set; }

        /// <summary>
        /// 应用名称
        /// </summary>
        [StringLength(maximumLength: 50)]
        public string AppName { get; set; }

        /// <summary>
        /// 应用Key
        /// </summary>
        [Required]
        public string AppKey { get; set; }

        /// <summary>
        /// 应用主页
        /// </summary>
        [Required]
        [StringLength(maximumLength: 255)]
        [Url]
        public string AppHomeUrl { get; set; }

        /// <summary>
        /// 付款默认通知地址
        /// </summary>
        [StringLength(maximumLength: 255)]
        [Url]
        public string PayDefaultNotifyUrl { get; set; }

        /// <summary>
        /// 付款默认返回地址
        /// </summary>
        [StringLength(maximumLength: 255)]
        [Url]
        public string PayDefaultReturnUrl { get; set; }

        /// <summary>
        /// 退款默认通知地址
        /// </summary>
        [StringLength(maximumLength: 255)]
        public string RefundDefaultNotifyUrl { get; set; }

        /// <summary>
        /// 公钥
        /// </summary>
        [Required]
        public string PublicKey { get; set; }

        /// <summary>
        /// 私钥
        /// </summary>
        [Required]
        public string PrivateKey { get; set; }

        /// <summary>
        /// 签名Key
        /// </summary>
        [Required]
        public string SignKey { get; set; }

        /// <summary>
        /// 状态(1表示正常)
        /// </summary>
        public int State { get; set; }

        /// <summary>
        /// 短信模板集合
        /// </summary>
        [ForeignKey("AppId")]
        public virtual ICollection<MerchantAppSmsTemplate> SmsTemplates { get; set; }
    }
}
